
//#define TEST_TEXTFILE
#ifdef TEST_TEXTFILE

#include "Win32.IO.TextFile.h"

void main()
{

   int i;
   for (i=0; i < 1000; i++)
   {
      Kif::Win32::IO::TextBuffer<char> *tb =
         Kif::Win32::IO::TextFile::ReadTextFile(L"c:/temp/nist.config");
      tb->MoveToFirstChar();
      while(tb->ReadLine())
         _tprintf(L"%s\n",tb->Line.GetBuffer());
      delete tb;
   }

   Kif::Win32::IO::TextFile tf;
   if (!tf.OpenReadWrite(L"c:/temp/test.txt"))
      _tprintf(L"File couldn't be opened.");
   else
      tf.Close();

   if (!tf.Create(L"c:/temp/newTest.txt"))
      _tprintf(L"Failed to create a new file.");
   else
      tf.Close();

   if (!tf.OpenRead(L"c:/temp/test.txt"))
      _tprintf(L"File couldn't be opened.");
   else
   {
      Kif::Win32::String s;
      s.AllocBuffer(1024+1);
      DWORD l = tf.Read(s);
      if (l == 0)
         _tprintf(L"Failed to read file.");
      else
         _tprintf(L"%s.",s.GetBuffer());
      tf.Close();
   }

}

#endif
